
package guoan.repository;

import java.util.List;

import guoan.domain.AutoFormInput;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface AutoFormInputRepository extends PagingAndSortingRepository<AutoFormInput, Long>, JpaSpecificationExecutor<AutoFormInput> {

    @Query(value = "SELECT t.`name` FROM auto_form_input t WHERE auto_form_id = :autoFormId ORDER BY order_id DESC", nativeQuery = true)
    List<String> findFormInputNames(@Param("autoFormId") Long autoFormId);

    List<AutoFormInput> findByAutoFormIdOrderByOrderIdDesc(Long autoFormId);

}
